import { menulist } from '@/api/system/menu-api'

const state = {
    menus: []
}

const mutations = {
    SET_MENUS: (state, menus) => {
        state.menus = menus
    }
}

const actions = {

    getMenu({ commit }) {
        console.log('getMenu')
        return new Promise((resolve, reject) => {
            menulist({all:0}).then(response => {
                const { data } = response
                console.log(data);
                commit('SET_MENUS', data)
                resolve()
            }).catch(error => {
                reject(error)
            })
        })

    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
